package com.tanhua.server.controller;

import com.tanhua.server.service.BaiDuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/baidu")
public class BaiDuController {
    @Autowired
    private BaiDuService baiDuService;

    /**
     * 更新位置
     * @param map
     * @return
     */
    @PostMapping("/location")
    public ResponseEntity updateLocation(@RequestBody Map map){
        Double longitude = Double.valueOf(map.get("longitude").toString());
        Double latitude = Double.valueOf(map.get("latitude").toString());
        String addrStr = map.get("addrStr").toString();
        baiDuService.updateLocation(longitude,latitude,addrStr);
        return ResponseEntity.ok(null);
    }
}
